// development_deck.h
// author: april lehman (apes@alum.dartmouth.org)

// Defines the development deck interface for the hexword.

// A development deck has:
//   14 soldiers
//   6 progress cards (2 each of monopoly, road building, year of plenty)
//   5 victory points.

// Use GetCard() to pull a random card, Size() to see how many cards
// are left, and Empty() to test if the deck is empty. Card types are
// represented by integers.  Given an integer i, use CardName(i) to get a
// string representing the card.

#ifndef _DEVELOPMENT_DECK_H_
#define _DEVELOPMENT_DECK_H_

#include <string>
#include <cstdlib> // For the random number generator.
#include <ctime>   // For seeding the random number generator.


using namespace std;
class DevelopmentDeck {
 public: 

  enum {
    SOLDIER,
    MONOPOLY,
    YEAR_OF_PLENTY,
    ROAD_BUILDING,
    VICTORY_POINT,
    INVALID,
  };

  DevelopmentDeck();
  ~DevelopmentDeck(){};
  
  //Accessors
  int Size() const { return size_; }

  // Convienence
  bool Empty() const { return size_ == 0; }

  // Mutators
  void Reset();

  // Returns a random card from the deck. When the deck is empty
  // invalid cards are returned.
  int GetCard();

  // Just for debugging.
  void PrintDeck();

  // Number of development card types, including invalid.
  static const int kNumDevTypes = 6;

  // Given an integer, representing a card, returns a string with the cards name.
  static const string &CardName(int type);

  // Returns true if the card is one of the valid types (i.e. soldier,
  // victory point, or progress card).
  static bool IsValid(int type);

  // Returns the total number of cards of a given type that are
  // available in the game. In otherwords, it always returns 14 for
  // the number of soldiers regardless of how many have been played.
  static int NumCardsOfType(int type);
 
 protected:
  static const int kMaxNumPerType[kNumDevTypes];
  int counts_[kNumDevTypes];  //count of each type of development card.
  int size_;     //total size of deck.

 private:
  int PickAType();
};

#endif // _DEVELOPMENT_DECK_H_
